<template>
<div>
  <h1>老师注册页面</h1>
  <p>用户名 <input type="text" v-model="form.username"></p>
  <p>密码 <input type="text" v-model="form.password"></p>
  <button @click="add">注册</button>

  <p>已注册的老师：</p>
  {{data}}
</div>
</template>

<script>
export default {
name: "Teacher",
  data(){
  return{
    form:{},
    data:""
  }
  },
  methods:{
  add(){
    this.axios.post('tea/',this.form).then(res=>{
      //注册成功后跳转到登录页面
      this.$router.push({"path":'/tlogin'})
    })
  },
    getTea(){
      this.axios.get("tea/").then(res=>{
          this.data=res.data.list
      })
    }
  },
  mounted() {
  this.getTea()
  }

}
</script>

<style scoped>

</style>
